class Position < ActiveRecord::Base
  has_many :order_items
  has_many :orders, :through => :order_items
  
  def self.get_positions(dir,order)
    direction = ""
    car_type = ""
    car_size = ""
    case dir
      when "前方"
      direction = "front"
      when "後方"
      direction = "rear"
      when "側面"
      direction = "side"
    end
    case order.car_type
      when "RV"
      car_type = "t_rv"
      when "ワゴン"
      car_type = "t_wagon"
      when "セダン"
      car_type = "t_sedan"
      when "ミニバン"
      car_type = "t_minivan"
    end
    case order.car_size
      when "軽自動車"
      car_size = "size_mini"
      when "普通車"
      car_size = "size_standard"
      when "大型車"
      car_size = "size_large"
    end
    positions = Position.find(:all, :conditions => ["#{direction} = ? and #{car_type} = ? and #{car_size} = ?", true,true,true])
  end
end
